<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 声明函数
    function getArrValue(arr = []) {
      let max = arr[0]
      // 开始循环
      for (let i = 1; i < arr.length; i++) {
        //比较条件，数值交换
        if (max < arr[i]) {
          max = arr[i]
        }
      }
      // 返回值
      return max
    }
    // 调用函数。打印结果
    let max = getArrValue([2, 3, 78, 8, 4, 9])
    console.log(max);


  </script>

</body>

</html>